package ${package.Entity};

<#list table.importPackages as pkg>
import ${pkg};
</#list>
<#if swagger2>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
<#if entityLombokModel>
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
</#if>

import ${package.Entity}.${entity};

/**
 * <p>
 * ${table.comment!}
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
<#if entityLombokModel>
@Data
</#if>
public class ${entity}VO {

<#-- ----------  BEGIN 字段循环遍历  ---------->
<#list table.fields as field>
    <#if field.keyFlag>
        <#assign keyPropertyName="${field.propertyName}"/>
    </#if>

    <#if field.comment!?length gt 0>
        <#if swagger2>
    /**
    * ${field.comment}
    */
    @ApiModelProperty(value = "${field.comment}")
        <#else>
    /**
     * ${field.comment}
     */
        </#if>
    </#if>
    private ${field.propertyType} ${mtc.initialLowercase(field.propertyName)};
</#list>
<#------------  END 字段循环遍历  ---------->

<#if !entityLombokModel>
    <#list table.fields as field>
        <#if field.propertyType == "boolean">
            <#assign getprefix="is"/>
        <#else>
            <#assign getprefix="get"/>
        </#if>
    public ${field.propertyType} ${getprefix}${field.capitalName}() {
        return ${mtc.initialLowercase(field.propertyName)};
    }

    <#if entityBuilderModel>
    public ${entity} set${field.capitalName}(${field.propertyType} ${mtc.initialLowercase(field.propertyName)}) {
    <#else>
    public void set${field.capitalName}(${field.propertyType} ${mtc.initialLowercase(field.propertyName)}) {
    </#if>
        this.${mtc.initialLowercase(field.propertyName)} = ${mtc.initialLowercase(field.propertyName)};
        <#if entityBuilderModel>
        return this;
        </#if>
    }
    </#list>
</#if>

<#if entityColumnConstant>
    <#list table.fields as field>
    public static final String ${field.name?upper_case} = "${field.name}";

    </#list>
</#if>
<#if activeRecord>
    @Override
    protected Serializable pkVal() {
    <#if keyPropertyName??>
        return this.${keyPropertyName};
    <#else>
        return null;
    </#if>
    }

</#if>
<#if !entityLombokModel>
    @Override
    public String toString() {
        return "${entity}{" +
    <#list table.fields as field>
        <#if field_index==0>
            "${mtc.initialLowercase(field.propertyName)}=" + ${mtc.initialLowercase(field.propertyName)} +
        <#else>
            ", ${mtc.initialLowercase(field.propertyName)}=" + ${mtc.initialLowercase(field.propertyName)} +
        </#if>
    </#list>
        "}";
    }
</#if>

    public static ${entity}VO entity2VO(${entity} entity) {
        ${entity}VO vo = new ${entity}VO();
    <#list table.fields as field>
        vo.set${field.capitalName}(entity.get${field.capitalName}());
    </#list>
        return vo;
    }

    public static ${entity} vo2Entity(${entity}VO vo) {
        ${entity} entity = new ${entity}();
    <#list table.fields as field>
        entity.set${field.capitalName}(vo.get${field.capitalName}());
    </#list>
        return entity;
    }
}
